﻿using System;

namespace Net35.Xrm.Sdk
{
	internal static class EnumExtensions
	{
		public static bool TryParse<TEnum>(string str, out TEnum result) where TEnum : struct
		{
			result = default(TEnum);
			try
			{
				result = (TEnum)Enum.Parse(typeof(TEnum), str, true);
				return true;
			}
			catch
			{
				return false;
			}
		}
	}
}